When [script] file download fails, how can I tell why?

Posted by Bruce on Stack Overflow See other posts from Stack Overflow or by Bruce
Published on 2010-06-11T18:22:46Z Indexed on 2010/06/11 21:23 UTC
Read the original article Hit count: 163

Filed under:
|
|

My web application sends me diagnostic info from the browser javascript telling me that a [script] tag I've injected has failed to download the associated .js file. I can't reproduce this locally, and there is no particular pattern to which file fails, or what the browser type is. There is a pattern to the geo location of the requests - Mexico and Brazil are always more frequent - so I'm guessing that perhaps the internet in general is just more flaky there, and it is just network issues causing the failures.

I'd really like to know for sure, though. Is there any way to determine, from the browser javascript, whether the failure occurred because of an error returned by the server, from a network error, or from a protocol timeout? I don't care if the mechanism is browser-specific, since it seems likely that the same issue is causing the error on all browser types.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dom